/**
 * 
 */
package org.skyeye.modeling.provider;

import java.util.Map.Entry;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.skyeye.modeling.image.IconFactory;
import org.skyeye.modeling.image.ImageConstants;
import org.skyeye.modeling.images.ImageInfo;
import org.skyeye.modeling.images.ImageProviderMapper;
import org.skyeye.modeling.model.DevBean;
import org.skyeye.modeling.model.MachBean;
import org.skyeye.modeling.model.RegBean;

import com.alibaba.fastjson.JSONObject;

/**
 * @author Vivian
 * @date 2017-6-26
 */
public class DeviceTreeLabelProvider extends LabelProvider {


	@Override
	public String getText(Object element) {
		if(element instanceof MachBean) {
			return ((MachBean)element).getMachname();
		} else if(element instanceof DevBean) {
			return ((DevBean)element).getDevname();
		} else if(element instanceof RegBean) {
			return ((RegBean)element).getRegname();
		}
		return "";
	}


	@Override
	public Image getImage(Object element) {
		if(element instanceof MachBean) {
			
			return ImageProviderMapper.getImage(ImageInfo.CONTROL_DISABLE_STOP);
		} else if(element instanceof DevBean) {
			return ImageProviderMapper.getImage(ImageInfo.CONTROL_DISABLE_START);
		} else if(element instanceof RegBean) {
			return ImageProviderMapper.getImage(ImageInfo.CONTROL_DISABLE_QUIT);
		}
		return null;
	}

}
